﻿using System.IO;
using System.Reflection;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using VisualWip.PresentationModel;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Globalization;

namespace PresnetationModelTests
{


    [TestClass()]
    public class NameToImageSourceConverterTest
    {


        private TestContext testContextInstance;

        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        [TestMethod()]
        public void ValidFileName_ShouldReturn_FileNameUnchanged()
        {
            NameToImageSourceConverter target = new NameToImageSourceConverter();
            string fileName = "ValidFileName";
            string expected = "ValidFileName";

            string actual = target.RemoveInvalidChars(fileName);  

            Assert.AreEqual(expected, actual);
        }
    

        [TestMethod()]
        public void InValidFileNameOneLeadingInValidChar_ShouldReturn_FileNameWithInvalidCharsRemoved()
        {
            NameToImageSourceConverter target = new NameToImageSourceConverter();
            string fileName = "*ValidFileName";
            string expected = "ValidFileName";

            string actual = target.RemoveInvalidChars(fileName);  

            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void InValidFileNameOneTrailingInValidChar_ShouldReturn_FileNameWithInvalidCharsRemoved()
        {
            NameToImageSourceConverter target = new NameToImageSourceConverter();
            string fileName = "ValidFileName/";
            string expected = "ValidFileName";

            string actual = target.RemoveInvalidChars(fileName);

            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void InValidFileNameMultipleInValidChar_ShouldReturn_FileNameWithInvalidCharsRemoved()
        {
            NameToImageSourceConverter target = new NameToImageSourceConverter();
            string fileName = "*Valid::*FileName/";
            string expected = "ValidFileName";

            string actual = target.RemoveInvalidChars(fileName);

            Assert.AreEqual(expected, actual);
        }

    }

}
